import { UserItem } from '../userModel';
import { AverageUserQueryParams, ExportParams } from './model';
import { BasicFetchResult } from '/@/api/model/baseMode';
import { defHttp } from '/@/utils/http/axios';

import { ErrorMessageMode } from '/@/utils/http/axios/types';

enum Api {
  List = '/baseInfo/overseasStudentManager/findPage',
  Lista = '/baseInfo/overseasStudentManager/findPageIsCheck',
  ChangeStatus = '/baseInfo/overseasStudentManager/isUse',
  Delete = '/baseInfo/overseasStudentManager/delete',
  Tuck = '/baseInfo/overseasStudentManager/sendCard',
  See = '/baseInfo/overseasStudentManager/findById', //查看
  Edit = '/baseInfo/overseasStudentManager/returnBack', //驳回
  Export = '/baseInfo/overseasStudentManager/export', //导出
}

/**
 * @description: 查询留学生
 */
export function ListApi(params: AverageUserQueryParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.get<BasicFetchResult<UserItem>>(
    {
      url: Api.List,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}
/**
 * @description: 查询留学生审核
 */
export function ListApia(params: AverageUserQueryParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.get<BasicFetchResult<UserItem>>(
    {
      url: Api.Lista,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}

/**
 * @description: 改变用户状态
 */
export function ChangeStatusApi(params: UserItem, mode: ErrorMessageMode = 'modal') {
  return defHttp.post(
    {
      url: Api.ChangeStatus,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}
/**
 * @description: 驳回
 */
export function EditApi(params, mode: ErrorMessageMode = 'modal') {
  return defHttp.post(
    {
      url: Api.Edit,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}

/**
 * @description: 删除用户
 */
export function DeleteApi(id: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.get(
    {
      url: Api.Delete + `/${id}`,
    },
    {
      errorMessageMode: mode,
    }
  );
}

/**
 * @description: 发卡
 */
export function TuckApi(params, mode: ErrorMessageMode = 'modal') {
  return defHttp.post(
    {
      url: Api.Tuck,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}

/**
 * @description: 查看
 */
export function DetailsApi(userId: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.get(
    {
      url: Api.See + `/${userId}`,
    },
    {
      errorMessageMode: mode,
    }
  );
}
/**
 * @description: 导出
 */
export function ExportApi(params: ExportParams, mode: ErrorMessageMode = 'modal') {
  return defHttp.get(
    {
      url: Api.Export,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}
